#include "mystdio.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>

int main() {
    MyFile* file = MyOpen("./log.txt", "a");
    if(file == NULL) {
        perror("open error");
        return 1;
    }
    int cnt = 10;
    while(cnt--) {
        char* message = (char*)"hello world!!!\n";
        MyFwrite(file, message, strlen(message));
        MyFFlush(file);
        printf("buffer: %s\n", file->buffer);
        sleep(1);
    }
    MyClose(file);
    return 0;
}